package io.renren.modules.app.indexController;

import java.util.Arrays;
import java.util.Map;

import io.renren.modules.app.entity.index.YcRegionEntity;
import io.renren.modules.app.service.index.YcRegionService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author lym
 * @email 928185446qq.com
 * @date 2023-12-26 16:03:48
 */
@RestController
@RequestMapping("record/ycregion")
public class YcRegionController {
    @Autowired
    private YcRegionService ycRegionService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("record:ycregion:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = ycRegionService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("record:ycregion:info")
    public R info(@PathVariable("id") Integer id){
		YcRegionEntity ycRegion = ycRegionService.getById(id);

        return R.ok().put("ycRegion", ycRegion);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("record:ycregion:save")
    public R save(@RequestBody YcRegionEntity ycRegion){
		ycRegionService.save(ycRegion);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("record:ycregion:update")
    public R update(@RequestBody YcRegionEntity ycRegion){
		ycRegionService.updateById(ycRegion);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("record:ycregion:delete")
    public R delete(@RequestBody Integer[] ids){
		ycRegionService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
